package com.cgc.venus.server.job.controller;

import com.cgc.venus.server.core.bean.response.VenusResponse;
import com.cgc.venus.server.core.bean.response.VenusResponseStatus;
import com.cgc.venus.server.core.exception.VenusException;
import com.cgc.venus.server.job.bean.AlarmInfo;
import com.cgc.venus.server.job.inter.AlarmService;
import com.cgc.venus.server.job.inter.JobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * Created by 业哥 on 2017/12/24
 */
@Api(value = "预警", description = "预警服务的api")
@RequestMapping("/alarm-admin")
@RestController
public class AlarmController {
    private static final Logger logger = LoggerFactory.getLogger(AlarmController.class);
    @Autowired
    private AlarmService alarmServiceImpl;


    @ApiOperation("查询预警信息")
    @RequestMapping(value = "/alarm", method = RequestMethod.GET)
    @ResponseBody
    public VenusResponse<Object> queryAlarm(@RequestParam(value="level")int level
            ,@RequestParam(value="status")int status
            ,@RequestParam(value="timeStart")String timeStart
            ,@RequestParam(value="timeEnd")String timeEnd
            ,@RequestParam(value="queryKey")String queryKey
            ,@RequestParam(value="currentPage")int currentPage) throws VenusException{
        AlarmInfo alarmInfo =alarmServiceImpl.queryAlarm(level,status,timeStart,timeEnd,queryKey,currentPage);
        VenusResponse<Object> response=new VenusResponse<Object>(VenusResponseStatus.OK,"",alarmInfo);
        return response;
    }
}